﻿using System;
using System.Collections.Generic;
using System.Text;
using SLF.NLogFacade;
using Slf.Resolvers;

namespace Slf.Samples.NLogToFile
{
  class Program
  {
    static void Main(string[] args)
    {
      // configure the logger service so that it uses a log4net factory
      // in order to supply ILogger instances.
      LoggerService.FactoryResolver = new SimpleFactoryResolver(
        new NLogLoggerFactory());

      // The NLogLoggerFactory above will configure the NLog 
      // framework by searching for the NLog XML configuration
      // in a number of pre-defined locations. See the NLog
      // documentation for details:
      // http://www.nlog-project.org/config.html
      //
      // In this example, the nlog.config file configure
      // the NLog framework to write to the file 'log.txt'

      DoSomeWork();
      Console.ReadLine();
    }


    private static void DoSomeWork()
    {
      ILogger logger = LoggerService.GetLogger("Logger.Name");
      logger.Info("Sample entry created {0}", DateTime.Now);
      Console.Write("Wrote log entry to log file 'log.txt'");
    }
  }
}